package com.sbk.xuanliu.result;

import com.sbk.xuanliu.enums.ReturnCode;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 孙壁凯
 * @Date: 2021/11/03/10:41
 * @Description:
 */
public class ResultData<T> {
    //状态
    private Integer status;
    //信息
    private String message;
    //数据
    private Object data;
    //时间
    private Date timestamp;

    public static ResultData fail2(int status,String message){
        String name = ReturnCode.getName(status);
        return new ResultData(status,name,null);
    }

    public static ResultData fail(int status,Object data,String message){
        return new ResultData(status,message,data);
    }

    public ResultData(Integer status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
        this.timestamp = new Date();
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }
}
